<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app" @click="handleClick">
        {{msg}}
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                msg:"hello word"
            },

            methods:{
                handleClick(){
                    this.msg = "change"
                }
            },
            beforeCreate() {
                console.log(1)  // undefined
            },
            created() {
                console.log(2)  // undefined
            },
            beforeMount() {
                console.log(3)  // undefined
            },
            // 只能在mounted这个生命周期函数中获取DOM
            mounted() {
                console.log(4) // <div id="test">good</div>
            },
            // 1. updated默认不会触发 2.data中的数据更新,updated一定会触发
            beforeUpdate() {
                console.log(5)
            },
            updated() {
                console.log(6)
            },
        })
    </script>
</body>
</html>